﻿
-- ================================================
-- Remarks: Not part of standard Stored Proc
-- ================================================
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'Ivy_UserManagement_UserSelfCreatedActivityAuthorization_GetSelfCreatedActivities')
	BEGIN
		DROP  Procedure  [Ivy_UserManagement_UserSelfCreatedActivityAuthorization_GetSelfCreatedActivities]
	END

GO

CREATE PROCEDURE [Ivy_UserManagement_UserSelfCreatedActivityAuthorization_GetSelfCreatedActivities] 
-- =============================================
-- Author:		<Mrinmoy>
-- Create date: <07/09/2016>
-- Description:	<Ivy_UserManagement_UserSelfCreatedActivityAuthorization_GetSelfCreatedActivities>
-- =============================================
-- Add the parameters for the stored procedure here
	(
				@ActivityCode varchar(50)
	)
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT OFF;

		SELECT	[Sys_ActivityMaster].[ActivityCode], 
				[Sys_ActivityTypeMaster].[ActivityTypeCode]
		FROM    [Sys_ActivityMaster] LEFT OUTER JOIN [Sys_ActivityTypeMaster] 
		ON		[Sys_ActivityMaster].[ActivityTypeKey] = [Sys_ActivityTypeMaster].[ActivityTypeKey] 
		WHERE   
				(
					([Sys_ActivityMaster].[ActivityCode] = @ActivityCode) AND 
					(
						([Sys_ActivityTypeMaster].[ActivityTypeCode] = 'SEE') OR 
						([Sys_ActivityTypeMaster].[ActivityTypeCode] = 'EDIT') OR
						([Sys_ActivityTypeMaster].[ActivityTypeCode] = 'REMOVE')
					)
				);
END
GO
